Skip to main content

All Questions

Tagged with
2votes
0answers
27views

Plpgsql function that redacts substrings wrapped with double pipes `||`

I'm using Postgres 14 and I've written a function (for use with Hasura GraphQL Computed Fields) that transforms a TEXT field, replacing all instances of spoiler-annotated text (e.g. ...
Alex Meuer's user avatar
3votes
0answers
1kviews

PL/pgSQL function to test if a word is contained within a phrase

I am using PostgreSQL 11.0 and I wrote a PL/pgSQL function to test if a word or phrase is contained within another phrase. This function is called several times within another function to extract some ...
Nina's user avatar
  • 131
3votes
1answer
55views

Iterate between dates and INSERT values in a performant way

I have created a query that populates a datapoint with random values. The logic is simple: Iterate between the START and END dates and INSERT random values. I want from this query to be very ...
Superluminal's user avatar
6votes
1answer
1kviews

Univariate analysis with SQL stored procedure

I wrote a SQL univariate analysis stored procedure taking as input a schemaname and a tablename on PostgreSQL. It is exactly like a PROC SAS UNIVARIATE. As output, you get less than 20 usable ...
user avatar
5votes
1answer
210views

Gathering distinct patient diagnosis records

This code correctly gathers diagnosis records for a patient to show distinct records based on the AMA ICD9 code, diagnosis description, and date of posting. The output is distinct on (ICD code, ...
Alan Wayne's user avatar
6votes
1answer
77views

Fixing logs that overlap

Here we trying to fix logs that have overlaps with each other. Am I doing it right? Is there any way to improve/refactor it? ...
Petr Guskov's user avatar

close